<?php
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/fingerprint.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/jquery-1.10.1.min.js",CClientScript::POS_HEAD);
//Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/alert.js",CClientScript::POS_HEAD);


Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.core.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.widget.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.scroller.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.util.datetime.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.datetimebase.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.widget.ios.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.i18n.zh.js",CClientScript::POS_HEAD);



Yii::app()->clientScript->registerCssFile("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/style.css");
Yii::app()->clientScript->registerScriptFile("http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile("https://s3-us-west-2.amazonaws.com/s.cdpn.io/63425/transit.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile("https://s3-us-west-2.amazonaws.com/s.cdpn.io/63425/transit.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile("https://s3-us-west-2.amazonaws.com/s.cdpn.io/63425/background.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/index.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/js_mobile_common_new.js",CClientScript::POS_HEAD);

?>
        <div id="hero">
            <div id="background_animate"></div>
          
            <span class="img_holder">
                <img class="dr-glue-little" src="<?php echo $this->staticsPath."/img/p_bg.png" ?>" alt="Dr Glue Little">
                <div class="left_arm">
                    <img src="<?php echo $this->staticsPath."/img/left-arm.png" ?>" alt="Left Arm">
                </div>
                <div class="right_arm">
                    <img src="<?php echo $this->staticsPath."/img/right-arm.png" ?>" alt="Right Arm">
                </div>
            </span>
        </div>
        <div >
        
            <div style="width:100%;margin-left:auto;margin-right:auto;">
            <form action="#" style="width:100%;margin-left:auto;margin-right:auto;" method="post" accept-charset="utf-8">
                 <div class="input_holder" style="width:80%;margin-left:auto;margin-right:auto;">
                <span><i class="fa fa-user" ></i></span><input type="text" style="width:80%;" name="password" id="password_field" placeholder="姓名" required>
            </div>
            <div class="input_holder"  style="width:80%;margin-left:auto;margin-right:auto;">
                <span><i class="fa fa-lock"></i></span><input type="text" id="s_code" style="width:80%;" name=s_code  placeholder="教师工号/学生学号" required>
            </div>
            <div  style="width:80%;margin-left:auto;margin-right:auto;text-align:center;height:40px;line-height:40px;" id="submit0"  class="submit_button">
                    登录
            </div>
            </form>
            </div>
           
        </div>
    <script type="text/javascript">
        (function () {
           $("#submit0").bind("click",function(){
				var s_code = $("#s_code").val();
				var s_name = $("#password_field").val();
				var tag =1;
				 $.ajax({
		                type: "POST",
		                url: '<?php echo Yii::app()->createUrl('index/ajaxLoginProduct') ?>',
		                data: {
		                    code:s_code,
		                    name:s_name,
		                    type:tag
		                },
		                dataType: "json",
		                success: function (data) {
		                    if (data) { 	
		                        if (data['status'] == 1) {
		                            localStorage["stroeUser"] = data['key'];
		                            <?php if($type==1){ ?>
		                            window.location.href='<?php echo Yii::app()->createUrl('user/member',array('openid'=>$openid)) ?>';
		                            <?php }else{ ?>
		                            window.location.href='<?php echo Yii::app()->createUrl('user/member',array('openid'=>$openid)) ?>';
		                            <?php } ?>
		                        } else {
		                            alert(data['message']);
		                            _this.css('background','#68c8c7');
		                            _this.html('立即登录');
		                            return false;
		                        }
		                    }
		                }
		            });
           });
           $("#submit1").bind("click",function(){
				var t_code = $("#t_code").val();
				var t_name = $("#t_name").val();
				var tag =2;
				 $.ajax({
		                type: "POST",
		                url: '<?php echo Yii::app()->createUrl('index/ajaxLoginProduct') ?>',
		                data: {
		                    code:t_code,
		                    name:t_name,
		                    type:tag
		                },
		                dataType: "json",
		                success: function (data) {
		                    if (data) {
		                    	  alert("OK");
		                        if (data['status'] == 1) {
		                            localStorage["stroeUser"] = data['key'];
		                            alert("OK");
		                            <?php if($type==1){ ?>	
		                            window.location.href='<?php echo Yii::app()->createUrl('user/member',array('openid'=>$openid)) ?>';
		                            <?php }else{ ?>
		                            window.location.href='<?php echo Yii::app()->createUrl('user/member',array('openid'=>$openid)) ?>';
		                            <?php } ?>
		                        } else {
		                            alert(data['message']);
		                            _this.css('background','#68c8c7');
		                            _this.html('立即登录');
		                            return false;
		                        }
		                    }
		                }
		            });
          });



        }());
    </script>

    